package com.qf;

import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import java.util.List;

/**
 * 2019/10/9
 * Administrator
 * springboot1009
 * 面向对象面向君  不负代码不负卿
 */
@SpringBootApplication
public class Test1  /*extends WebMvcConfigurerAdapter*/ {
   /* @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        System.out.println("aaaaaa");
        FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();

        FastJsonConfig config = new FastJsonConfig();
        config.setSerializerFeatures(SerializerFeature.PrettyFormat);

        converter.setFastJsonConfig(config);

        converters.add(converter);
    }*/

   //json日期转换方式2
  @Bean
    public HttpMessageConverters a1(){
        System.out.println("aaaaa11111");
        FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
        FastJsonConfig config = new FastJsonConfig();
        config.setSerializerFeatures(SerializerFeature.PrettyFormat);

        converter.setFastJsonConfig(config);
        HttpMessageConverter converters=(HttpMessageConverter)converter;
        return new HttpMessageConverters(converters);
    }

    public static void main(String[] args) {
        SpringApplication.run(Test1.class,args);
    }
}
